package com.blinddate.controller;

import com.blinddate.pojo.result.Result;
import com.blinddate.pojo.vo.UserInfVO;
import com.blinddate.service.InterestService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/interest")
@Slf4j
@Api(tags = "用户收藏相关接口")
public class InterestController {
    @Autowired
    private InterestService interestService;

    @PostMapping
    @ApiOperation("添加收藏")
    public Result AddInterest(Long id){
        interestService.add(id);
        return Result.success();

    }
    @GetMapping("/list")
    @ApiOperation("展示收藏列表")
    public Result list(@RequestParam Integer page,@RequestParam Integer size){
        List<UserInfVO> list = interestService.list(page, size);
        return Result.success(list);
    }
    @DeleteMapping
    @ApiOperation("取消收藏")
    public Result delete(Long id){
        interestService.delete(id);
        return Result.success();
    }
}
